package app.server.project.main.service.service;

import app.server.project.main.service.constants.GlobalCfgKey;
import app.server.project.main.service.db.dao.cfg.GlobalCfgDao;
import app.server.project.main.service.db.entity.cfg.GlobalCfgEntity;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
@RequiredArgsConstructor
public class ActiveService {

    private final GlobalCfgDao globalCfgDao;

    public List<String> getActiveUrl() {
        var lst = this.globalCfgDao.getGlobalCfgEntityList();
        var ret = lst.stream().filter(v -> v.getId().startsWith(GlobalCfgKey.Active_Url))
                .map(GlobalCfgEntity::getVal).collect(Collectors.toList());

        return ret;
    }
}
